<table class="box2"><tr><td style="width:50%; height:10px;">

<h2><?=tr('News')?></h2>
<p class="backpage"><?=fgsBase::linkPage('&raquo; '.tr('See all news'), 'news')?></p>   
<?
	$news = fgsNews::getLast(fgsLang::getLang(), 2);
	if (is_array($news)) {
		foreach ($news as $row) {
			printf('
				<div class="news_entry">
					<h3>%s</h3>
					<div class="time">%s</div>
					<div class="text">%s</div>
				</div>',
				$row['title'],
				fgsUtils::formatDate($row['date']),
				$row['text']
			);
		}
	} else {
		echo tr('No news yet');
	}
?>

</td><td rowspan="2">

<h2><?=tr('Latest Matchs')?></h2>
<p class="backpage"><?=fgsBase::linkPage('&raquo; '.tr('See statistics in real time'), 'stats')?></p>   
<?
	$table = new htmlTable();
	$table->setHeader('game', array(
		'width' => '16px',
	));
	$table->setHeader('id', array(
		'title' => '#',
		'width' => '7ex',
	));
	$table->setHeader('date', array(
		'title' => tr('Started'),
		'width' => '15ex',
	));
	$table->setHeader('duration', array(
		'title' => tr('Duration'),
	));
	/**
	$table->setHeader('status', array(
		'title' => tr('Status'),
		'width' => '10ex',
	));
	**/
	$table->setHeader('count', array(
		'title' => tr('Nb'),
		'width' => '3ex',
	));

	$matchs = fgsMatchs::getLast(20, false, array('nostalled' => true));
	if (is_array($matchs)) {

		foreach ($matchs as $k=>$match) {
			
			if ($match['match_status_ret'] == -1) 
				$table->setLineParam('class', 'disabled'); 
				
			$table->set('id', fgsBase::linkPage('#'.$k, 'match', array($k)));
			$table->set('date', fgsUtils::formatDate($match['match_datecreate'], 1));
			$table->set('duration', fgsUtils::formatSeconds($match['match_duration']));
			$table->set('status', $match['match_status']);
			$table->set('count', $match['nb_players']);

			$table->set('game', fgsBase::linkPage(
				sprintf('<img src="%s" alt="%s"/>', fgsBase::link('game', array($match['game_gid'], 'logo', 'icon16')), $match['game_name']),
				'game', array($match['game_gid'])
			));

			$table->push();
		}
		
		echo $table->render();
	} else {
		echo tr('No matchs yet.');
	}

?>
</td></tr>
<tr><td>

<h2><?=tr('Online players')?></h2>
<?
	$users = fgsUsers::getOnline();
	if (!count($users))
		printf('<p>%s</p>', tr('No player online'));
	else
		print_r($users);
?>

</td></tr></table>
